package com.dxy.yesas2020goals.study.partone.disignpattern.strategypattern.mine;

/**
 * @author victorydeng
 * @Classname Test
 * @Description TODO
 * @Date 2020/3/23 19:33
 * @Created by victorydeng
 */
public class Test {

    public static void main(String[] args) {
        Case case1 = new Case("NO123061","APPLY",10d);
        Case case2 = new Case("NO123063","SUCCESS",1000d);
        Case case3 = new Case("NO123063","FAIL",1000d);
        System.out.println("案件状态："+ case1.getCaseStaus()+ "花费" + casePay(case1));
        System.out.println("案件状态："+ case2.getCaseStaus()+ "花费" + casePay(case2));
        System.out.println("案件状态："+ case3.getCaseStaus()+ "花费" + casePay(case3));

        System.out.println("案件状态2："+ case1.getCaseStaus()+ "花费" + casePayPluse(case1));
        System.out.println("案件状态2："+ case2.getCaseStaus()+ "花费" + casePayPluse(case2));
        System.out.println("案件状态2："+ case3.getCaseStaus()+ "花费" + casePayPluse(case3));

    }

    public static Double casePay(Case c){
        if("FAIL".equalsIgnoreCase(c.getCaseStaus())){
           return 0*c.getCasePrice();
        } else  if("SUCCESS".equalsIgnoreCase(c.getCaseStaus())) {
            return 2*c.getCasePrice();
        } else if("APPLY".equalsIgnoreCase(c.getCaseStaus())) {
            return 0.5*c.getCasePrice();
        }
        return 0d;
    }

    public static Double casePayPluse(Case c){
        return PayStrateFactory.getInstance().getPayStrategy(c.getCaseStaus()).pay(c);
    }


}
